package com.bingxue.edu.framework.excel.model;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.bingxue.edu.common.enums.OperateSourceEnum;
import com.bingxue.edu.common.enums.OrderStatusEnum;
import com.bingxue.edu.common.enums.PayTypeEnum;
import com.bingxue.edu.framework.excel.converter.ExcelBooleanConverter;
import com.bingxue.edu.framework.excel.converter.OperateSourceConverter;
import com.bingxue.edu.framework.excel.converter.OrderStatusConverter;
import com.bingxue.edu.framework.excel.converter.PayTypeConverter;
import com.mybatisflex.annotation.Column;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Schema(description = "订单列表excel导出模型")
public class OrderExportModel {

    @Schema(description = "学生id")
    @ExcelProperty(index = 0,value = "学生id")
    private String studentId;

    @Schema(description = "学生名称")
    @ExcelProperty(index = 1,value = "学生名称")
    private String studentName;

    @Schema(description = "原始总价")
    @ExcelProperty(index = 2,value = "原始总价")
    private BigDecimal originalTotalPrice;

    @Schema(description = "实际总价")
    @ExcelProperty(index = 3,value = "实际总价")
    private BigDecimal actualTotalPrice;

    @Schema(description = "折扣信息")
    @ExcelProperty(index = 4,value = "折扣信息")
    @ColumnWidth(30)
    private String discountDetail;

    @Schema(description = "订单状态")
    @ExcelProperty(index = 5,value = "订单状态",converter = OrderStatusConverter.class)
    private OrderStatusEnum status;

    @Schema(description = "是否支付")
    @ExcelProperty(index = 6,value = "是否支付",converter = ExcelBooleanConverter.class)
    private Boolean payOff;

    @Schema(description = "支付方式")
    @ExcelProperty(index = 7,value = "支付方式",converter = PayTypeConverter.class)
    private PayTypeEnum payType;

    @Schema(description = "支付时间")
    @ExcelProperty(index = 8,value = "支付时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ColumnWidth(20)
    private LocalDateTime payTime;

    @Schema(description = "外部交易号")
    @ExcelProperty(index = 9,value = "外部交易号")
    @ColumnWidth(20)
    private String outTradeNo;

    @Schema(description = "财务账户")
    @ExcelProperty(index = 10,value = "财务账户")
    @ColumnWidth(20)
    private String finAccountId;

    @Schema(description = "取消时间")
    @ColumnWidth(20)
    @ExcelProperty(index = 11,value = "取消时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private LocalDateTime cancelTime;

//    @Schema(description = "是否退款")
//    @ExcelProperty(index = 12,value = "是否退款",converter = ExcelBooleanConverter.class)
//    private Boolean refunded;

    @Schema(description = "备注（内部）")
    @ExcelProperty(index = 13,value = "备注（内部）")
    @ColumnWidth(20)
    private String remark;

    @Schema(name = "操作来源")
    @ExcelProperty(index = 14,value = "操作来源",converter = OperateSourceConverter.class)
    private OperateSourceEnum operateSource;

    @Schema(name = "支付详情")
    @Column(isLarge = true)
    @ExcelProperty(index = 15,value = "支付详情")
    @ColumnWidth(20)
    private String payOrderDetail;

    @Schema(description = "有效期截止时间")
    @ExcelProperty(index = 16,value = "有效期截止时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ColumnWidth(20)
    private LocalDateTime endValidTime;
}
